#include <stdio.h>
#include <string.h>

int main()
{
    char a[100] = "12+5=;34-1=;23*2=;456/3";
    char b[100] = { 0 };
    char *s = strtok(a, ";");
    while(s)
    {
        //printf("%s\n", s);
        int i, j;
        char c;
        sscanf(s, "%d%c%d=", &i, &c, &j);
        int res = 0;
        switch(c)
        {
        case '+':
            res = i + j;
            break;
        case '-':
            res = i - j;
            break;
        case '*':
            res = i * j;
            break;
        case '/':
            res = i / j;
            break;
        default:
            res = 0;
            break;
        }

        char tmp[10] = { 0 };
        sprintf(tmp, "%s%d;", s, res);
        printf("%s\n", tmp);
        strcat(b, tmp);
        printf("%s\n", b);
        s = strtok(NULL, ";");
    }
    strcpy(a, b);
    printf("\n");
    printf("%s\n", a);

    return 0;
}

